// ============================== 导入依赖 ============================== //

// ============================== 导出异步调用 ============================== //

export default {
  // —————————————————————————————— 下拉框 —————————————————————————————— //

  async remoteSelect({ state: { API, MAP, selectParam }, rootState }) {
    if (!selectParam.id) return []

    const TIP = API.transTip(MAP.tipSelect, rootState.API)
    const { list = [] } = await API.getOne(selectParam, '查询巡更轨迹', TIP)
    return transSelect(list)
  },
}

// ============================== 转换方法 ============================== //

const transSelect = (arr) => {
  arr.sort((a, b) => a.arriveTime - b.arriveTime)
  return arr
}
